package com.bdqn.controller;

import java.util.List;

import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import com.bdqn.entity.Department;

import com.bdqn.mapper.DepartmentMapper;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;

@Controller
@RequestMapping("/sys/dept")
public class DepartmentController {

	@Autowired
	private DepartmentMapper departmentMapper;
	
	@RequestMapping("/findAllDept")
	public String getAllDepartment(HttpSession session,@RequestParam(value = "pageno", defaultValue = "1") int pageNo) {
		System.out.println("执行查询所有部门信息!!");
		PageHelper.startPage(pageNo, 5);
		List<Department> listRole =departmentMapper.getAllDepartment();
		PageInfo<Department> pageInfo = new PageInfo<>(listRole);
		session.setAttribute("pageInfo", pageInfo);
		return "redirect:/jsp/sys/dept/deptList.jsp";
		
	}

}
